load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "infoschema",
    srcs = [
        "builder.go",
        "cache.go",
        "cluster.go",
        "error.go",
        "infoschema.go",
        "metric_table_def.go",
        "metrics_schema.go",
        "tables.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/infoschema",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/ddl/placement",
        "//pkg/ddl/resourcegroup",
        "//pkg/domain/infosync",
        "//pkg/errno",
        "//pkg/infoschema/metrics",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/meta/autoid",
        "//pkg/parser/auth",
        "//pkg/parser/charset",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/privilege",
        "//pkg/session/txninfo",
        "//pkg/sessionctx",
        "//pkg/sessionctx/variable",
        "//pkg/table",
        "//pkg/table/tables",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/dbterror",
        "//pkg/util/deadlockhistory",
        "//pkg/util/domainutil",
        "//pkg/util/execdetails",
        "//pkg/util/logutil",
        "//pkg/util/mock",
        "//pkg/util/sem",
        "//pkg/util/set",
        "//pkg/util/sqlexec",
        "//pkg/util/stmtsummary",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/diagnosticspb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_pd_client//http",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//credentials",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "infoschema_test",
    timeout = "short",
    srcs = [
        "infoschema_test.go",
        "main_test.go",
        "metrics_schema_test.go",
    ],
    embed = [":infoschema"],
    flaky = True,
    shard_count = 8,
    deps = [
        "//pkg/ddl/placement",
        "//pkg/domain",
        "//pkg/kv",
        "//pkg/meta",
        "//pkg/meta/autoid",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/session",
        "//pkg/store/mockstore",
        "//pkg/table",
        "//pkg/testkit",
        "//pkg/testkit/testsetup",
        "//pkg/testkit/testutil",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/set",
        "@com_github_pingcap_errors//:errors",
        "@com_github_prometheus_prometheus//promql/parser",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
